// Can be implemented via window.onbeforeunload.
// For example:
<script type="text/javascript">
window.onbeforeunload = function() {
return "Are you sure you want to leave?";
}
</script>
<script type="text/javascript">
window.onbeforeunload = function() {
return "Dude, are you sure you want to leave? Think of the kittens!";
}
</script>